<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>原材料采购管理</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
 
  <link rel="stylesheet" href="../../res/css/wholesale/font.css">
  <link rel="stylesheet" href="../../res/css/wholesale/xadmin.css">
  <link rel="stylesheet" href="../../res/layui/css/layui.css">
  <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
  <script type="text/javascript" src="../../res/layui/layui.js" charset="utf-8"></script>
  <script type="text/javascript" src="../../res/js/wholesale/xadmin.js"></script>
</head>
<body>
<div class="demoTable" style="margin-top: 10px;">
 
    <div class="x-body">
    <div class="layui-input-inline">
      <form class="layui-form" action="">
       <div class="layui-input-inline">
     	 请选择供应商：
      </div>
          <div class="layui-input-inline" style="width:224px;">
          		
		      <select name="supplierId" lay-filter="aihao" id="supplierId" lay-search >
		       <option value=""></option>
		      </select>
   		 </div>
        
      </form>
      </div>
       <div class="layui-input-inline">
      	<button class="layui-btn" id="search" data-type="reload" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
      </div>
      <xblock>
        <button class="layui-btn" id="insert"><i class="layui-icon"></i>添加</button>
      </xblock>
<table class="layui-table"  lay-filter="demo" id="purchase">
  
</table>

 </div>
 </div>
 
 
 <script type="text/javascript">
layui.use('table',function(){
	  var table = layui.table;
	  var form = layui.form;
	  
	  table.render({
		    elem: '#purchase'
		    ,page: true
		    ,width: '100%'
		    ,url:'../../listenPurchase/materialFindAll.action'
		    ,cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
		    ,cols: [[
		       {field:'purchaseId', align:'center'}
		      ,{field:'companyName',title: '公司名称', align:'center',width: '130'}
		      ,{field:'oper',title: '操作人', align:'center',width: '130'}
		      ,{field:'purchaseStringTime',title: '采购时间', align:'center',sort:true,width: '180'}
		      ,{field:'purchasePrice',title: '采购金额', align:'center',width: '160'}
		      ,{field:'purchaseNumber',title: '采购数量', align:'center',width: '160'}
		      ,{field:'supplierId',title: '供应商', align:'center',width: '180'}
		      ,{field:'auditingStatus',title: '进度状态', align:'center',templet:'#auditingType',width: '130'}
		      ,{field:'purchaseExplain',title: '采购说明', align:'center',width: '130'}
		      ,{field:'right', align:'center', toolbar: '#barDemo',title:'操作',width: '350',fixed: 'right'}
		    ]],done: function (res, curr, count) {
	            $("[data-field='purchaseId']").css('display','none');
	           
		    }
		  });
});


</script>

<script type="text/html" id="auditingType">
	{{# if(d.auditingStatus == 0) { }}
     <div>未提交审核</div>
	{{#  }else if(d.auditingStatus == 1) { }}
     <div>等待财务审核</div>
 	 {{# } else if(d.auditingStatus == 2){ }}
    <div>等待总经理审核</div>
     {{# } else if(d.auditingStatus == 3){ }}
    <div>已通过审核</div>
 	 {{# } else if(d.auditingStatus == 4){ }}
    <div>未通过审核</div>
 {{# } else if(d.auditingStatus == 5){ }}
    <div>已提交质检</div>
 	 
{{# }}}
</script>

<script type="text/html" id="barDemo">
	{{# if(d.auditingStatus == 0) { }}
    <a class="layui-btn layui-btn-xs" lay-event="edit">修改</a>
  	<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
	<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="auditing">提交审核</a>
  	<a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="detail">采购明细</a>
  	<a class="layui-btn layui-btn-disabled layui-btn-xs">提交质检</a>
	{{#  }else if(d.auditingStatus == 1) { }}
    <a class="layui-btn layui-btn-disabled layui-btn-xs">修改</a>
  	<a class="layui-btn layui-btn-disabled layui-btn-xs">删除</a>
	<a class="layui-btn layui-btn-disabled layui-btn-xs">提交审核</a>
  	<a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="detail">采购明细</a>
  	<a class="layui-btn layui-btn-disabled layui-btn-xs">提交质检</a>
 	 {{# } else if(d.auditingStatus == 2){ }}
    <a class="layui-btn layui-btn-disabled layui-btn-xs">修改</a>
  	<a class="layui-btn layui-btn-disabled layui-btn-xs">删除</a>
	<a class="layui-btn layui-btn-disabled layui-btn-xs">提交审核</a>
  	<a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="detail">采购明细</a>
  	<a class="layui-btn layui-btn-disabled layui-btn-xs">提交质检</a>
     {{# } else if(d.auditingStatus == 3){ }}
  	<a class="layui-btn layui-btn-disabled layui-btn-xs" lay-event="edit">修改</a>
  	<a class="layui-btn layui-btn-disabled layui-btn-xs" lay-event="del">删除</a>
	<a class="layui-btn layui-btn-disabled layui-btn-xs">提交审核</a>
  	<a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="detail">采购明细</a>
  	<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="quality">提交质检</a>
 {{# } else if(d.auditingStatus == 4){ }}
  	<a class="layui-btn layui-btn-xs" lay-event="edit">修改</a>
  	<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
	<a class="layui-btn layui-btn-disabled layui-btn-xs">提交审核</a>
  	<a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="detail">采购明细</a>
  	<a class="layui-btn layui-btn-disabled layui-btn-xs">提交质检</a>
 {{# } else if(d.auditingStatus == 5){ }}
  	   <a class="layui-btn layui-btn-disabled layui-btn-xs">修改</a>
  	<a class="layui-btn layui-btn-disabled layui-btn-xs">删除</a>
	<a class="layui-btn layui-btn-disabled layui-btn-xs">提交审核</a>
  	<a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="detail">采购明细</a>
  	<a class="layui-btn layui-btn-disabled layui-btn-xs">提交质检</a>
{{# }}}
 
</script>
 

<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script type="text/javascript" src="../../res/js/PurchaseRawstock/purchase.js"></script>
</body>
</html>